#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__title__ = ''
__author__ = 'python'
__mtime__ = '18-9-8'
# code is far away from bugs with the god animal protecting ~
"""
from redis import StrictRedis
from datetime import timedelta
import logging


class Conifg:
	DEBUG = True
	SECRET_KEY = "pakyyAMdAzIl8N1vTGNztM/QEzDgrTFS10KHP37AZNqIixUJaCeXHQ=="

	# 配置数据库的链接
	SQLALCHEMY_DATABASE_URI = "mysql+pymysql://user:1234@localhost/flask_proj_news"
	SQLALCHEMY_TRACK_MODIFICATIONS = False

	# 状态保持的session信息存储在redis数据库中
	# from flask_session import Session 在源码中可以找到相关的代码
	# if config['SESSION_TYPE'] == 'redis':
	# 	session_interface = RedisSessionInterface(config['SESSION_REDIS'], config['SESSION_KEY_PREFIX'],
	# 		config['SESSION_USE_SIGNER'], config['SESSION_PERMANENT'])

	REDIS_IP = '127.0.0.1'
	REDIS_PORT = 6379

	SESSION_TYPE = 'redis'
	SESSION_REDIS = StrictRedis(host=REDIS_IP, port=REDIS_PORT)  # 指定session信息链接的数据库实例
	SESSION_USE_SIGNER = True  # 对session信息进行签名
	PERMANENT_SESSION_LIFETIME = timedelta(days=1)  # 指定session信息的有效期，在Flask的配置文件中可以找到

	LOGGER_LEVEL = logging.INFO

class DevelopConfig(Conifg):
	DEBUG = True
	WTF_CSRF_ENABLED = False


class ProduceConfig(Conifg):
	DEBUG = False


config = {"develop": DevelopConfig, "porduce": ProduceConfig}

if __name__ == '__main__':
	pass
